package com.xiaomi.mapper;

import com.xiaomi.entity.Vehicle;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VehicleMapper {
    /**
     * 新增车辆信息
     * @param vehicle
     */
    void insert(Vehicle vehicle);

    /**
     * 查询全部车辆信息
     * @return
     */
    @Select("select * from vehicle_info")
    List<Vehicle> getAll();

    @Select("select frame_number from vehicle_info")
    List<Long> getAllVid();

    @Select("select * from vehicle_info where frame_number = #{FrameNumber}")
    Vehicle getById(Long FrameNumber);

    void update(Vehicle vehicle);

    @Delete("delete from vehicle_info where frame_number = #{FrameNumber}")
    void deleteById(Long FrameNumber);
}
